<?php
use kartik\form\ActiveForm;
use yii\bootstrap\Html;
use wodrow\yii2wtools\tools\JsBlock;
use yii\helpers\Url;
use common\Tools;
use common\models\db\AdminPower;
use common\models\db\AdminRolePower;
/**
 * @var \yii\web\View $this
 * @var \fztadmin\modules\rbac\models\forms\AdminRole $model
 * @var string $attribute
 * @var array $tree_data
 */
?>

    <div>
        <?php foreach($tree_data as $k => $v): ?>
            <?php if ($v['_child'] ?? null): ?>
                <h5>
                    <label>
                        <?= $v['name'] ?>
                    </label>
                </h5>
                <div class="" style="padding-left: 2em;">
                    <?php
                    echo $this->render('index', [
                        'tree_data' => $v['_child'],
                        'model' => $model,
                        'attribute' => $attribute,
                    ]);
                    ?>
                </div>
            <?php else: ?>
                <?php if($v['type'] == AdminPower::TYPE_FUN): ?>
                    <div class="checkbox-line">
                        <label class="pull-left"  style="min-width: 3em;padding-right: 2em;">
                            <?= $v['name'] ?>
                            <?=Html::radioList($model->formName() . "[{$attribute}][{$v['id']}]", $v['data_rule'], AdminRolePower::instance()->getDataRuleDesc(), ['class' => ""]) ?>
                        </label>
                    </div>
                <?php else: ?>
                    <div class="checkbox-line">
                        <label class="pull-left"  style="min-width: 3em;padding-right: 2em;">
                            <?= $v['name'] ?>
                        </label>
                    </div>
                <?php endif; ?>

                <div class="clearfix"></div>
            <?php endif; ?>
        <?php endforeach; ?>
    </div>